import { showConfirmDialog } from 'vant'
import { DialogTheme } from 'vant/lib/dialog/types'
//theme = 'round-button'
export const useDeleteConfirm = (
  callback: () => void,
  title = '注意',
  message = '确定删除吗？',
  theme = 'default' as DialogTheme,
  rollback: () => void = () => {}
) => {
  return new Promise((resolve) => {
    showConfirmDialog({ title, message, theme })
      .then(() => {
        callback()
        resolve(true)
      })
      .catch(() => {
        rollback()
        resolve(false)
      })
  })
}
